package com.fanjia.crm.web.controller;

import com.fanjia.crm.model.Permission;
import com.fanjia.crm.service.IPermissionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by FanJia on 2020/9/16 11:09
 */
@Controller
public class IndexController {
    @Autowired
    IPermissionService permissionService;


   Logger logger = LoggerFactory.getLogger(IndexController.class);


    @RequestMapping("/index")
    public String index(Model model){
        System.out.println("加油");
        logger.info("加油");
        logger.error("加油");
        logger.warn("加油");



        List<Permission> menuList = permissionService.findAllMenus();
        for(Permission menu : menuList){
            System.out.println(menu);
        }
        model.addAttribute("menuList",menuList);
        return "index";
    }

    
    @RequestMapping("/error403")
    public String error403(){
        return "/error403";
    }



}
